refactor: update custom validator definition#250
Merged
Conversation
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the impossible_empty validator from a plain function to a callable class instance, ensuring consistent validator usage across all schema table classes. The change improves the correctness of validator behavior by making impossible_empty a factory function that returns validator instances.
Changes:
- Converted
impossible_emptyto a factory function that returns_ImpossibleEmptyValidatorinstances - Updated all schema table fields to use
impossible_empty()with parentheses instead of passing the function directly - Simplified validator tuple structure in
AutolabelModelby removing unnecessary nested lists
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| t4_devkit/schema/tables/base.py | Refactored impossible_empty to a factory function returning _ImpossibleEmptyValidator class instances |
| t4_devkit/schema/tables/calibrated_sensor.py | Updated sensor_token field to use impossible_empty() |
| t4_devkit/schema/tables/instance.py | Updated category_token field to use impossible_empty() |
| t4_devkit/schema/tables/keypoint.py | Updated sample_data_token, instance_token, and category_tokens fields to use impossible_empty() |
| t4_devkit/schema/tables/lidarseg.py | Updated sample_data_token field to use impossible_empty() |
| t4_devkit/schema/tables/map.py | Updated log_tokens field to use impossible_empty() |
| t4_devkit/schema/tables/object_ann.py | Updated sample_data_token, instance_token, category_token, and attribute_tokens fields to use impossible_empty() |
| t4_devkit/schema/tables/sample.py | Updated scene_token field to use impossible_empty() |
| t4_devkit/schema/tables/sample_annotation.py | Updated sample_token, instance_token, attribute_tokens, and visibility_token fields to use impossible_empty() |
| t4_devkit/schema/tables/sample_data.py | Updated ego_pose_token and calibrated_sensor_token fields to use impossible_empty() |
| t4_devkit/schema/tables/scene.py | Updated log_token, first_sample_token, and last_sample_token fields to use impossible_empty() |
| t4_devkit/schema/tables/surface_ann.py | Updated sample_data_token and category_token fields to use impossible_empty() |
| t4_devkit/schema/tables/autolabel_metadata.py | Simplified validator tuple structure for score and uncertainty fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
mojomex
added a commit
that referenced
this pull request
Jan 30, 2026
* chore(deps): restrict rerun-sdk to versions >=0.20.0,<0.28.0 (#248) * Bump version from 0.5.2 to 0.5.3 (#247) * Bump version from 0.5.2 to 0.5.3 * Pin rerun-sdk dependency to version 0.20.0 * refactor: update custom validator definition (#250) * refactor: update custom validator definition Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * Update t4_devkit/schema/tables/base.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: modity type of size to tuple[int, int] (#251) Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * fix: abstract away category indexing differences Semseg and non-semseg datasets behave differently (position-based vs. explicit indexing). Now computing index field in case position-based indexing is used. Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): don't fail when map is not present Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): fix iteration freezing when skipping a pointcloud without lidarseg file Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * feat(rendering): auto-enable SEGMENTATION coloring when lidarseg is available Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * docs: checkmark for semseg viz Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): fix wrongly named `color_mode` args Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * refactor(compatibility): move to schema package Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> Co-authored-by: Kotaro Uetake <60615504+ktro2828@users.noreply.github.com> Co-authored-by: Samrat Thapa <38401989+SamratThapa120@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ktro2828
added a commit
that referenced
this pull request
Jan 30, 2026
* chore(deps): restrict rerun-sdk to versions >=0.20.0,<0.28.0 (#248) * Bump version from 0.5.2 to 0.5.3 (#247) * Bump version from 0.5.2 to 0.5.3 * Pin rerun-sdk dependency to version 0.20.0 * refactor: update custom validator definition (#250) * refactor: update custom validator definition Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * Update t4_devkit/schema/tables/base.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: modity type of size to tuple[int, int] (#251) Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * fix: abstract away category indexing differences Semseg and non-semseg datasets behave differently (position-based vs. explicit indexing). Now computing index field in case position-based indexing is used. Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): don't fail when map is not present Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): fix iteration freezing when skipping a pointcloud without lidarseg file Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * feat(rendering): auto-enable SEGMENTATION coloring when lidarseg is available Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * docs: checkmark for semseg viz Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): fix wrongly named `color_mode` args Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * refactor(compatibility): move to schema package Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> Co-authored-by: Kotaro Uetake <60615504+ktro2828@users.noreply.github.com> Co-authored-by: Samrat Thapa <38401989+SamratThapa120@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ktro2828
added a commit
that referenced
this pull request
Jan 30, 2026
* chore(deps): restrict rerun-sdk to versions >=0.20.0,<0.28.0 (#248) * Bump version from 0.5.2 to 0.5.3 (#247) * Bump version from 0.5.2 to 0.5.3 * Pin rerun-sdk dependency to version 0.20.0 * refactor: update custom validator definition (#250) * refactor: update custom validator definition Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * Update t4_devkit/schema/tables/base.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: modity type of size to tuple[int, int] (#251) Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * fix: abstract away category indexing differences Semseg and non-semseg datasets behave differently (position-based vs. explicit indexing). Now computing index field in case position-based indexing is used. Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): don't fail when map is not present Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): fix iteration freezing when skipping a pointcloud without lidarseg file Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * feat(rendering): auto-enable SEGMENTATION coloring when lidarseg is available Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * docs: checkmark for semseg viz Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): fix wrongly named `color_mode` args Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * refactor(compatibility): move to schema package Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> Co-authored-by: Kotaro Uetake <60615504+ktro2828@users.noreply.github.com> Co-authored-by: Samrat Thapa <38401989+SamratThapa120@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ktro2828
added a commit
that referenced
this pull request
Feb 2, 2026
* feat: add support of rendering segmentation pointcloud Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * feat: separate lidarseg method Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * chore(viewer): lidarseg tweaks (#256) * chore(deps): restrict rerun-sdk to versions >=0.20.0,<0.28.0 (#248) * Bump version from 0.5.2 to 0.5.3 (#247) * Bump version from 0.5.2 to 0.5.3 * Pin rerun-sdk dependency to version 0.20.0 * refactor: update custom validator definition (#250) * refactor: update custom validator definition Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * Update t4_devkit/schema/tables/base.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: modity type of size to tuple[int, int] (#251) Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * fix: abstract away category indexing differences Semseg and non-semseg datasets behave differently (position-based vs. explicit indexing). Now computing index field in case position-based indexing is used. Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): don't fail when map is not present Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): fix iteration freezing when skipping a pointcloud without lidarseg file Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * feat(rendering): auto-enable SEGMENTATION coloring when lidarseg is available Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * docs: checkmark for semseg viz Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * fix(rendering): fix wrongly named `color_mode` args Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> * refactor(compatibility): move to schema package Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> Co-authored-by: Kotaro Uetake <60615504+ktro2828@users.noreply.github.com> Co-authored-by: Samrat Thapa <38401989+SamratThapa120@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: remove lidarseg command from t4viz Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * refactor: replace lidarseg existence checke Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * feat: add support of rendering segmentation pointcloud Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * fix: resolve invalid usage of future submitting and enable to raise exceptions Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * docs: add visualization sample Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * refactor: remove RerunViewer.render_pointcloud(...) Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp> Co-authored-by: Max Schmeller <6088931+mojomex@users.noreply.github.com> Co-authored-by: Samrat Thapa <38401989+SamratThapa120@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This pull request refactors the implementation and usage of the
impossible_emptyvalidator across multiple schema table classes to improve consistency and correctness. The validator is now a callable class instance rather than a plain function, and its usage is updated throughout the codebase. Additionally, some minor improvements are made to how tuple validators are structured for certain fields.Validator refactoring and usage updates:
impossible_emptyfrom a function to a callable class (_ImpossibleEmptyValidator) and updated all schema table fields to useimpossible_empty()instead of passing the function directly. This ensures correct validator behavior and consistency across all dataclasses. [1] [2]CalibratedSensor,Instance,Keypoint,LidarSeg,Map,ObjectAnn,Sample,SampleAnnotation,SampleData,Scene, andSurfaceAnn) to use the newimpossible_empty()validator invocation. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]Validator tuple structure improvements:
scoreanduncertaintyfield validators inAutolabelModelto use a flat tuple of validators, improving readability and correctness.